package com.albaba.designpattern.decorator.text_001;

/**
 * @author zx
 * @version 1.0
 * @description 具体装饰类
 * @date 2025/2/20 20:39
 */
public class ConcreteDecorator extends Decorator{

    public ConcreteDecorator(Component component) {
        super(component);
    }

    @Override
    public void operation() {
        super.operation(); // 调用原有业务方法,并没有真正的进行装饰，而是提供了一个统一的接口，将装饰的过程交给子类去实现
        addBehavior(); // 添加新的装饰逻辑
    }

    public void addBehavior() {
        // 添加新的装饰逻辑
        System.out.println("添加新的装饰逻辑");
    }

    public static void main(String[] args) {
        Component component = new ConcreteComponent();
        Decorator decorator = new ConcreteDecorator(component);
        decorator.operation();

    }
}
